Tool Call Repair Function
Callback invoked when a tool call's JSON arguments fail to decode (the model emitted JSON that doesn't match the tool's input schema, or referenced an unknown tool). Return a corrected ContentPart.ToolCall to retry execution, or null to give up (the loop emits StreamEvent.ToolError for this call).
Mirrors v6's experimental_repairToolCall (tool-call-repair-function.ts:20-27). On-device targets like Gemma 4 E2B hallucinate args at ~5%; at that rate a self-healing pass is mandatory for reliability.
The repair function MAY reroute to a different tool by returning a ContentPart.ToolCall with a different toolName — the agent re-resolves via ToolSet.find and retries decode + execute. A single repair attempt per call (no recursive repair) to keep loops bounded.